package greedy;

public class IncreasingTripletSubsequence334 {
    //todo
        public boolean increasingTriplet(int[] nums) {
            if(nums.length<3){
                return false;
            }
            int first = Integer.MAX_VALUE;
            int second = Integer.MAX_VALUE;
            for (int i = 0; i < nums.length; i++) {
                if(nums[i]>second){
                    return true;
                }else if(nums[i]<first){
                    first = nums[i];
                }else if(nums[i]>first&&nums[i]<second){
                    second = nums[i];
                }
            }
            return false;
        }
}
